﻿using System.Collections.Generic;
using System.Linq;

namespace Sustainalytics.ClientDW.Entities
{
    public class GCPrincipleEventIndicatorImpact : GCPrincipleEventIndicator, IEqualityComparer<GCPrincipleEventIndicatorImpact>
    {
        public string ImpactSummary { get; set; }
        public List<string> ImpactComments { get; set; }

        public bool Equals(GCPrincipleEventIndicatorImpact x, GCPrincipleEventIndicatorImpact y)
        {
            if (x == null && y == null)
                return true;

            if (x == null || y == null)
                return false;

            return
                new GCPrincipleEventIndicator().Equals(x, y)
                && x.ImpactSummary == y.ImpactSummary
                && ((x.ImpactComments == null && y.ImpactComments == null)
                    || (x.ImpactComments.SequenceEqual(y.ImpactComments)));
        }

        public int GetHashCode(GCPrincipleEventIndicatorImpact obj)
        {
            return this.Id.GetHashCode();
        }
    }
}
